package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.IcPostsMapper;
import com.ruoyi.system.domain.IcPosts;
import com.ruoyi.system.service.IIcPostsService;
import com.ruoyi.common.core.text.Convert;

/**
 * 帖子Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-07-11
 */
@Service
public class IcPostsServiceImpl implements IIcPostsService 
{
    @Autowired
    private IcPostsMapper icPostsMapper;

    /**
     * 查询帖子
     * 
     * @param postId 帖子主键
     * @return 帖子
     */
    @Override
    public IcPosts selectIcPostsByPostId(Long postId)
    {
        return icPostsMapper.selectIcPostsByPostId(postId);
    }

    /**
     * 查询帖子列表
     * 
     * @param icPosts 帖子
     * @return 帖子
     */
    @Override
    public List<IcPosts> selectIcPostsList(IcPosts icPosts)
    {
        return icPostsMapper.selectIcPostsList(icPosts);
    }

    /**
     * 新增帖子
     * 
     * @param icPosts 帖子
     * @return 结果
     */
    @Override
    public int insertIcPosts(IcPosts icPosts)
    {
        icPosts.setCreateTime(DateUtils.getNowDate());
        return icPostsMapper.insertIcPosts(icPosts);
    }

    /**
     * 修改帖子
     * 
     * @param icPosts 帖子
     * @return 结果
     */
    @Override
    public int updateIcPosts(IcPosts icPosts)
    {
        icPosts.setUpdateTime(DateUtils.getNowDate());
        return icPostsMapper.updateIcPosts(icPosts);
    }

    /**
     * 批量删除帖子
     * 
     * @param postIds 需要删除的帖子主键
     * @return 结果
     */
    @Override
    public int deleteIcPostsByPostIds(String postIds)
    {
        return icPostsMapper.deleteIcPostsByPostIds(Convert.toStrArray(postIds));
    }

    /**
     * 删除帖子信息
     * 
     * @param postId 帖子主键
     * @return 结果
     */
    @Override
    public int deleteIcPostsByPostId(Long postId)
    {
        return icPostsMapper.deleteIcPostsByPostId(postId);
    }
}
